package 博客.组合模式;

import java.util.ArrayList;
import java.util.List;

/**
 * 学院
 */
public class College extends Organization{
    private List<Organization> list=new ArrayList<>();//班级list
    public College(String name) {
        super(name);
    }


    //重写add方法
    public void add(Organization organization) {
        list.add(organization);
    }

    //重写remove方法
    public void remove(Organization organization) {
        list.remove(organization);
    }

    //展示方法，和学校无异
    public void display() {
        System.out.println("---------------"+this.getName()+"---------------------");
        for (Organization organization : list) {
            organization.display();
        }
    }
}
